package com.sunny.ynhz.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sunny.ynhz.R;
import com.sunny.ynhz.bean.ProblemStaticBean;
import com.sunny.ynhz.bean.StandardBean;
import com.sunny.ynhz.utils.TimeUtils;

import java.util.List;

/**
 * Created by huhuan123 on 2018/8/9.
 *
 * @describe TODO
 */

public class ProblemBJAdapter extends BaseQuickAdapter<ProblemStaticBean.DateBean, BaseViewHolder> {
    public ProblemBJAdapter(@Nullable List<ProblemStaticBean.DateBean> data) {
        super(R.layout.item_city_db, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ProblemStaticBean.DateBean item) {
        helper.setText(R.id.tv_city, item.getNAME());
        if (item.getPCOUNT() != 0) {
            helper.setText(R.id.tv_db_liv, TimeUtils.floatSava2((item.getYCOUNT() / (float) item.getPCOUNT()) * 100) + "%");
        } else {
            helper.setText(R.id.tv_db_liv, (0 + ""));
        }
        helper.setText(R.id.tv_db_number, item.getYCOUNT() + "").setText(R.id.tv_totla_number, item.getPCOUNT() + "");
    }
}
